package com.zzyl.controller.customer;


import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.CountVo;
import com.zzyl.vo.NursePlanProjectVo;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/customer/orders/project")
public class CustomerOrdersController {
    @Autowired
    private NursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目
     * @param name
     * @param pageNum
     * @param pageSize
     * @param status
     * @return
     */
    @GetMapping("/page")
    public ResponseResult<PageResponse> selectPage(
            @RequestParam(name = "name",required = false)String name,
            @RequestParam(name = "pageNum",defaultValue = "1")Integer pageNum,
            @RequestParam(name = "pageSize",defaultValue = "10")Integer pageSize,
            @RequestParam(name = "status",required = false)Integer status
    ) {
        PageResponse<NursingProjectVo> page = nursingProjectService.findByPage(name,status,pageNum,pageSize);
        return ResponseResult.success(page);
    }

    /**
     * 根据id查询护理项目
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> selectProjectById(@PathVariable(name = "id")Integer id) {
        NursingProjectVo nursingProjectVo = nursingProjectService.selectById(id);
        return ResponseResult.success(nursingProjectVo);
    }



}
